import unittest
from alg import minimumTotal
from gen import generate_triangle

class TestMinimumTotal(unittest.TestCase):
    def test_example(self):
        triangle = [
            [2],
            [3, 4],
            [6, 5, 7],
            [4, 1, 8, 3]
        ]
        self.assertEqual(minimumTotal(triangle), 11)

    def test_single_element(self):
        triangle = [[5]]
        self.assertEqual(minimumTotal(triangle), 5)

    def test_random_triangle(self):
        triangle = generate_triangle(10)
        result = minimumTotal(triangle)
        self.assertIsInstance(result, int)

if __name__ == '__main__':
    unittest.main()    